/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.srcptit.javatrainning.hieptq.btvn1;

import java.util.Scanner;

/**
 *
 * @author Hiep
 */
public class Bai2 {
    public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		System.out.print("Nhap 2 so a va b: ");
		int a=sc.nextInt();
		int b=sc.nextInt();
		int a1= a; 
		int b1= b; 
		while(a1!=b1){
			if(a1>b1)
				a1=a1-b1;
			else
				b1=b1-a1;
				}
		System.out.println("UCLN cua "+a+" va "+b+" la: "+a1);
		}

    
}
